package gui;

import java.util.HashMap;
import java.util.Map;

public abstract class Help
{
   protected Help next;
   protected Map<String, String> helpMap;

   public Help setNext(Help help)
   {
      this.next = help;
      return help;
   }
   
   public String showHelp(String element)
   {
      if(next == null)
         return "Domain Model Editor";
      else
         return next.getHelp(element);
   }

   abstract protected String getHelp(String element);
}

class UIHelp extends Help
{
   public UIHelp()
   {
      this.helpMap = new HashMap();
      // JButton help, in the form ( button_name, help_string )
     helpMap.put("AddButton", "This is a clickable button.");
     helpMap.put("EditButton", "This is a clickable button.");
     helpMap.put("RemoveButton", "This is a clickable button.");
     helpMap.put("GenerateButton",  "This is a clickable button.");
     helpMap.put("LoadButton", "This is a clickable button.");
     helpMap.put("SaveButton", "This is a clickable button.");
     helpMap.put("AutomaticHighlightButton", "This is a clickable button.");

     helpMap.put("EditorTextPane", "This is an editable text pane.");
     helpMap.put("DomainConceptList", "This is an editable list.");

     helpMap.put("jlbClass", "A color-coded label.");
     helpMap.put("jlbAttribute", "A color-coded label.");
     helpMap.put("jlbAssociation", "A color-coded label.");
     helpMap.put("jlbAggregation", "A color-coded label.");
     helpMap.put("jlbInheritance", "A color-coded label.");
     helpMap.put("jlbRole", "A color-coded label.");
     helpMap.put("jlbMultiplicity", "A color-coded label.");
   }

   public String getHelp(String element)
   {
      if(this.next == null)
         return this.helpMap.get((String)element);
      else
         return next.getHelp(element);
   }
}

class SpecificHelp extends Help
{
   public SpecificHelp()
   {
      this.helpMap = new HashMap();

      // Button context-dependent help
      helpMap.put("AddButton", "Add a new model concept to the list.");
      helpMap.put("EditButton", "Edit a domain phrase to more accurately represent a model concept.");
      helpMap.put("RemoveButton", "Remove a model concept from the list.");
      helpMap.put("GenerateButton",  "Generate a domain model based on the concepts in the list.");
      helpMap.put("LoadButton", "Load a list of model requirements into the Domain Model Editor.");
      helpMap.put("SaveButton", "Save the list of model requirements.");
      helpMap.put("AutomaticHighlightButton", "Automatically highlight domain phrases in the requirements.");

      helpMap.put("EditorTextPane", "These are the requirements which will be translated into domain model concepts.");
      helpMap.put("DomainConceptList", "A list of domain concepts based on the requirements listed in the requirement text pane, above.");

      helpMap.put("jlbClass", "An object-oriented class, often denoted by noun phrases in requirements.");
      helpMap.put("jlbAttribute", "An attribute of a class.");
      helpMap.put("jlbAssociation", "An association between classes.");
      helpMap.put("jlbAggregation", "An aggregation of classes.");
      helpMap.put("jlbInheritance", "Inheritance of classes, often denoted by phrases such as 'is a' .");
      helpMap.put("jlbRole", "A role played by a class or object.");
      helpMap.put("jlbMultiplicity", "Multiplicity, which applies to relationships, often denoted by numerical phrases in the requirements.");
   }

   public String getHelp(String element)
   {
      if(this.next == null)
         return this.helpMap.get((String)element);
      else
         return this.next.getHelp(element);
   }
}